<?php


class WSB_Validator_TemplatePlaceholder extends Zend_Validate_Abstract
{

    const IS_EMPTY = 'templatePlaceholderIsEmpty';

	/**
	 * @var array
	 */
    protected $_messageTemplates = array(
        self::IS_EMPTY => "Value is empty, but a non-empty value is required"
    );

    /**
     * @param string $value
     * @param array $context
     * @return boolean
     */
    public function isValid($value, array $context = null)
    {
    	if(!empty($context['pid'])) {
    		if(empty($value)) {
	    		$this->_error(self::IS_EMPTY);
	    		return false;
    		}
    	}
        return true;
    }
}
